import { pget, postFileByFormData, ppostJson } from '@/utils/req';
import { modalApi } from '@/utils/modalReq';

// 获取仓储档案列表
export function getWarehousearchivesList(query?: any) {
  return pget(`${modalApi.storage}/warehousearchives/list`, query);
}

// 新增仓储档案
export function addWarehousearchives(data: any) {
  return ppostJson(`${modalApi.storage}/warehousearchives/save`, data);
}

// 修改仓储档案
export function editWarehousearchives(data: any) {
  return ppostJson(`${modalApi.storage}/warehousearchives/update`, data);
}

// 查看仓储档案详情
export function warehousearchivesInfo(id: string) {
  return pget(`${modalApi.storage}/warehousearchives/detail/${id}`);
}

// 删除仓储档案
export function deleteWarehousearchives(id: string) {
  return ppostJson(`${modalApi.storage}/warehousearchives/remove/${id}`);
}

// 根据条件获取所有仓库
export function getAllParking(query?: any) {
  return pget(`${modalApi.storage}/warehousearchives/getAllParking`, query);
}
/** 获取导入失败列表 */
export function getErrorExcelList(query: any) {
  return pget(
    `${modalApi.storage}/assetsaccidentdataprocessing/warehouseArchivesPage`, query
  );
}

/** 保存物料导入数据 */
export function importWarehouseExcel(query?: any) {
  return postFileByFormData(
    `${modalApi.storage}/warehousearchives/importWarehouseExcel`,
    query,
  );
}
